package com.coffee.core.util;

import org.apache.commons.lang3.StringUtils;

/**
 * 密码加密工具
 *
 * @author Xulg
 * Created in 2019-06-01 9:44
 */
@SuppressWarnings("unused")
public class PasswordEncryptUtils {

    private static final String ENCRYPT_AUTH_KEY = "{_ENCRYPT_AUTN_KEY_}";

    /**
     * 密码加密
     *
     * @param password the password
     * @return the encrypt password
     */
    public static String encryptPassword(String password) {
        if (StringUtils.isBlank(password)) {
            throw new IllegalArgumentException("密码不能为空");
        }
        password = password.trim() + ENCRYPT_AUTH_KEY;
        return MD5Util.getMD5Str(password);
    }

}